<template class="bg">
	<view class="container top">
		<view class="review-item">
			<view class="review-header">
				<text class="p1">张**</text><text class="p2">评价时间:{{currentTime}}</text>
				<text class="p3" @click="goToOrderDetail">202101010245</text>
			</view>
			<view class="review-content">
				<text class="p4">综合评分:3分</text>
				<view class="star-container">
					<text v-for="index in 5" :key="index" class="star" :class="{ 'star-active': index <= 3 }">★</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { ref, onMounted } from 'vue';
	
	const currentTime = ref('');
	
	onMounted(() => {
	  const now = new Date();
	  const year = now.getFullYear();
	  const month = now.getMonth() + 1;
	  const day = now.getDate();
	  const hours = now.getHours();
	  const minutes = now.getMinutes();
	  const seconds = now.getSeconds();
	
	  currentTime.value = `${year}-${padZero(month)}-${padZero(day)} ${padZero(hours)}:${padZero(minutes)}:${padZero(seconds)}`;
	});
	
	function padZero(num) {
	  return num < 10 ? '0' + num : num;
	}
	
	function goToOrderDetail() {
	  uni.navigateTo({
		url: '/pages/pingjia/order-detail'
	  });
	}
</script>

<style>
	.top {
		width: 100%;
		height: 400rpx;
		background-image: url(/static/xiao@3x.png);
		background-repeat: no-repeat;
		background-size: 100%;
	}
	.container {
		min-height: 100vh;
		background-color: #fff;
		padding: 20rpx;
		width: 700rpx;
	}
	
	.review-item {
		background-color: #ffffff;
		border-radius: 12rpx;
		padding: 20rpx;
		margin-bottom: 20rpx;
		box-shadow: 0 2rpx 4rpx rgba(0,0,0,0.1);
		width: 690rpx;
		margin-left: -16rpx;
	}
	
	.review-header {
		padding-bottom: 20rpx;
		border-bottom: 1rpx solid #eee;
		margin-bottom: 20rpx;
	}
	
	.review-content {
		padding: 10rpx 0;
	}
	
	.p1 {
		color: #333;
		font-size: 28rpx;
		font-weight: 500;
		margin-right: 20rpx;
	}
	
	.p2 {
		font-size: 24rpx;
		color: #999;
	}
	
	.p3 {
		color: #1d6fff;
		text-decoration: underline;
		font-size: 24rpx;
		float: right;
	}
	
	.p4 {
		margin-left: 10rpx;
		font-size: 28rpx;
		margin-right: 20rpx;
		display: inline-block;
		color: #666;
	}
	
	.star-container {
		display: inline-block;
		vertical-align: middle;
	}
	
	.star {
		font-size: 32rpx;
		color: #ddd;
		margin-right: 10rpx;
	}
	
	.star-active {
		color: #ffd700;
	}
</style>
